package edu.hunan.cxb18.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;

/**
 * @author AuthorName
 * @create 2020-04-02 14:31
 */
@Controller
public class ModelAndViewController {
    @RequestMapping("/ModelAndView")
    public ModelAndView test(){
        ModelAndView mv = new ModelAndView("mv");
        mv.addObject("time",new Date().toString());
        return mv;
    }
    @RequestMapping("/testMap")
    public String testMap(ModelMap modelMap, Model model, Map<String,Object> map){
        modelMap.put("modelmap", Arrays.asList("tom","lili"));
        map.put("map","map");
        model.addAttribute("model","model");
      return "mv";
    }
}
